package com.springmvc.shangguigu.dao;

import com.springmvc.shangguigu.entities.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * DepartmentDao--SpringMVC-test
 *
 * @author: Jovi
 * @createTime: 2018-09-10 15:34
 **/
@Repository
public class DepartmentDao {

    private static Map<Integer,Department> departments = null;

    static{

        departments = new HashMap<>();

        departments.put(101, new Department(101, "D-AA"));
        departments.put(102, new Department(101, "D-BB"));
        departments.put(103, new Department(101, "D-CC"));
        departments.put(104, new Department(101, "D-DD"));
        departments.put(105, new Department(101, "D-EE"));

    }

    public Collection<Department> getDepartments() {
        return departments.values();
    }

    public Department getDepartMent(Integer id) {
        return departments.get(id);
    }
}
